
<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">

            <div class="layui-form-item">
                <label for="L_username" class="layui-form-label">
                    <span class="x-red">*</span>楼栋</label>
                <div class="layui-input-inline">
                    <input type="text" name="building" required=""
                           lay-verify="building" autocomplete="off" class="layui-input" placeholder="请输入楼栋" value="{$list.building}" id="building">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" type="button" onclick="edits({$list.id})">增加</button></div>
        </form>
    </div>
</div>

</body>
<script>
    function edits(id){
        $.ajax({
            type:"post",
            url: "{:url('index/buildings/edits')}",
            data: {
                id:id,
                building:$('#building').val()
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>
</html>
